package com.hex.ds.hdtp.core.inf.metadata.converter;

import com.hex.ds.hdtp.core.inf.metadata.entity.TableFieldsEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.Map;

/**
 * @Package com.hex.ds.hdtp.core.inf.metadata.converter
 * @ClassName IOracleSqlResultMapper
 * @Description oracle sql的结果转对象
 * @Author Wang zhihao
 * @Date 2023/8/14 15:44
 * @Version v1.0
 **/
@Mapper(componentModel = "spring")
public interface IDmSqlResultMapper {

    @Mapping(source = "COLUMN_ID", target = "columnId")
    @Mapping(source = "COLUMN_NAME", target = "columnName")
    @Mapping(source = "DATA_TYPE", target = "columnType")
    @Mapping(source = "DATA_LENGTH", target = "columnLength")
    @Mapping(source = "COMMENTS", target = "columnCommet")
    @Mapping(source = "OWNER", target = "dataBaseName")
    @Mapping(source = "TABLE_NAME", target = "tableName")
    @Mapping(source = "IS_PARTITION_FIELD", target = "partitioningColumn")
    @Mapping(source = "IS_PRIMARY_KEY", target = "isPrimaryKey")
    @Mapping(source = "NULLABLE", target = "isAllowNull")
    @Mapping(source = "DATA_TYPE_LENGTH", target = "columnTypeLength")
    TableFieldsEntity toTableFieldsBean(Map<String, String> sqlResult);
}
